import "./style"
import "./assets/iconfont/iconfont.js"
import "./assets/css/icon.less"
import {createApp} from 'vue'
import App from './App.vue'
import naive from 'naive-ui'
import { setupStore } from '@/store';
import router, {setupRouter} from "@/router"
import {setupGlobDirectives} from "@/directives"
import { AppProvider } from '@/components/Application';

async function Start() {
    // 提供naive的message，modal，Dialog，Notification，LoadingBar的支持
    const appProvider = createApp(AppProvider);
    const app = createApp(App);
    // 装载naiveUI
    app.use(naive)
    // 状态管理设置
    setupStore(app)
    // 指令相关
    setupGlobDirectives(app)
    //优先挂载一下 Provider 解决路由守卫，Axios中可使用，Dialog，Message 等之类组件
    appProvider.mount('#appProvider', true);
    // 路由设置
    await setupRouter(app)
    // 路由准备就绪后挂载APP实例
    await router.isReady();
    app.mount('#app',true);
}

Start()
